package com.yfp.client.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfp.client.domain.ClientAddress;
import com.yfp.client.service.ClientAddressService;
import com.yfp.client.mapper.ClientAddressMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
*
* @description 针对表【client_address(客户收货地址)】的数据库操作Service实现
* @createDate 2025-03-05 11:58:15
*/
@Service
public class ClientAddressServiceImpl extends ServiceImpl<ClientAddressMapper, ClientAddress>
    implements ClientAddressService{
    @Resource
    private ClientAddressMapper clientAddressMapper;


    @Override
    public void editByClientId(String clientId) {
        clientAddressMapper.editByClientId(clientId);
    }

    @Override
    public ClientAddress findDefaultByClientId(String clientId) {
        ClientAddress clientAddress = clientAddressMapper.findDefaultByClientId(clientId);
        if (null == clientAddress){
            clientAddress = clientAddressMapper.findLastByClientId(clientId);
        }
        return clientAddress;
    }
}




